
/*
 * @Author: LCL 
 * @Date: 2018-06-19 20:45:21
 * @Desc: string工具类
 */

const wx = window['wx']

export class KingWXUtil {
    private static wxGameCire = null;
    private static wxFeedBack = null;

    //创建游戏圈
    public static createGameCirc(){
      // if(cc.sys.platform !== cc.sys.WECHAT_GAME){return;}   
      // if(!KingWXUtil.wxGameCire){
      //   KingWXUtil.wxGameCire = wx.createGameClubButton({
      //         // icon: 'white',
      //         // type: 'text',
      //         // text: '游戏圈',
      //         type: 'image',
      //         image: 'http://cdn.taoquanbaapp.com/wxGameCirc.png?v=2',
      //         // image:'http://192.168.6.131:8888/kingeraweb/quan.png',
      //         style: {
      //           left: 20,
      //           top: 30,
      //           width: 37,
      //           height: 40,
      //         }
      //     })
      //     console.log("创建游戏圈",KingWXUtil.wxGameCire)
      // }
      // KingWXUtil.wxGameCire.show();
      // console.log("显示游戏圈",KingWXUtil.wxGameCire)
  }
   
  //隐藏游戏圈
  public static hideGameCirc(){
      // if(cc.sys.platform !== cc.sys.WECHAT_GAME){return;}   
      // if(!KingWXUtil.wxGameCire)return;
      // KingWXUtil.wxGameCire.hide();
      // console.log("隐藏游戏圈",KingWXUtil.wxGameCire)
  }

  //创建反馈
  public static createFeedback(){
    if(cc.sys.platform == cc.sys.WECHAT_GAME){
      KingWXUtil.wxFeedBack = wx.createFeedbackButton({
          type: 'image',
          // image: 'assets/resources/Altas/Common/wx_feedback_btn.png',
          image: 'http://cdn.taoquanbaapp.com/wx_feedback_btn.png?v=2',
          // image:'http://192.168.6.131:8888/kingeraweb/fankui.png',
          style: {
            left: 80,
            top: 30,
            width: 37,
            height: 43,
          //   lineHeight: 40,
            backgroundColor: '#ff0000',
          //   color: '#ffffff',
          //   textAlign: 'center',
          //   fontSize: 16,
          //   borderRadius: 4
          }
        })
    } 
  }

  //创建反馈
  public static hideFeedback(){
    if(cc.sys.platform !== cc.sys.WECHAT_GAME){return;}   
      if(!KingWXUtil.wxFeedBack)return;
      KingWXUtil.wxFeedBack.hide();
      console.log("隐藏反馈",KingWXUtil.wxFeedBack)
  } 

  public static showShake(){
    if(cc.sys.platform !== cc.sys.WECHAT_GAME){return;}   
      wx.vibrateShort();
  }

  public static saveUserScore(score){
    if(cc.sys.platform !== cc.sys.WECHAT_GAME){return;}  
    wx.setUserCloudStorage({
      KVDataList: [{ key: "score", value: "" + score }],
      // success: res => { console.log("设置开放成功", res); },
      // fail:res=>{console.error("设置开放域失败",res)},
      // complete:res=>{}
  }) 
  }

  public static getUserScore(){
    if(cc.sys.platform !== cc.sys.WECHAT_GAME){return;}  
    wx.getUserCloudStorage({
      keyList: ["score"],
      success: function (res) {
      var data = res.KVDataList;
      console.log("data = ", data);
      //doit()
      }
      });
    }




}

/*
public void TEXT1() 
{
	int textNum = 1;
	if (textNum == 1) 
	{
		textNum = 2;
    }
}
public void TEXT2()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}
public void TEXT3()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT4()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT5()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT6()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT8()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT9()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT10()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT11()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT12()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT13()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT14()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT15()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT16()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT17()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}
*/


     
